import parallelLimit from 'async/parallelLimit';
import PdcSpider from './analyzers/PdcSpider';

const startTimer = Date.now();

parallelLimit(
  [
    (cb) => {
      PdcSpider(cb);
    },
  ]
, 1, (err, result) => {
  if (err) {
    console.error('index exec error');
  } else {
    const endTimer = Date.now();
    const usedSeconds = Math.floor((endTimer - startTimer) / 1000);
    console.log(`total: ${result}`);
    console.log('index exec success ============>');
    console.log('---------------------------------');
    console.log(`-   耗时-> ${Math.floor(usedSeconds / 60)}分: ${usedSeconds - (Math.floor(usedSeconds / 60) * 60)}秒  <-耗时    -`);
    console.log('---------------------------------');
    process.exit(0);
  }
});
